package com.example.mydesignmodule.combination;

import java.util.ArrayList;

/**
 * @author tgw
 * @date 2021/3/10
 * @describe
 */
class Root extends Common {

    public Root(String nodeName) {
        super(nodeName);
    }

    @Override
    void doSomeThing() {
        for (Common common:commonArrayList){

            common.doSomeThing();
        }
    }

    @Override
    public void addCommon(Common common) {
        commonArrayList.add(common);
    }
    @Override
    public void removeCommon(Common common) {
        commonArrayList.remove(common);
    }

    @Override
    public Common getCommon(int index) {
        if (index < commonArrayList.size()) {
            return commonArrayList.get(index);
        } else {
            return null;
        }
    }
}
